package com.goldcn.common;


public enum StatusEnum {
    //调用构造函数来构造枚举项
    NORMAL(0), STOPED(1),DELETED(2);

    private int value = 0;

    //必须是private的，否则编译错误
    private StatusEnum(int value) {
        this.value = value;
    }

    //手写的从int到enum的转换函数
    public static StatusEnum valueOf(int value) {
        switch (value) {
        case 0:
            return NORMAL;
        case 1:
            return STOPED;
        case 2:
            return DELETED;
        default:
            return NORMAL;
        }
    }

    public int value() {
        return this.value;
    }
}